﻿' NOTE: If you change the class name "UserService" here, you must also update the reference to "UserService" in Web.config and in the associated .svc file.
Public Class UserService
    Implements IUserService

    Public Function Login(ByVal loginData As LoginType) As TokenType Implements IUserService.Login
        Dim token As New TokenType
        Try
            If Membership.ValidateUser(loginData.Username, loginData.Password) = True Then
                ' User is valid so now update the player record with GUID
                Using db As New TyranntDataContext
                    token.TokenGUID = db.GeneratePlayerGuid(loginData.Username)
                    token.UserAlias = db.GetPlayerDisplayName(loginData.Username)
                End Using
            End If
        Catch ex As Exception
            token.UserAlias = "{error}" + ex.Message
        End Try

        Return token
    End Function
End Class

